﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XSTDZ.ERP.Application.DataContracts;
using XSTDZ.ERP.Domain.Models;
using XSTDZ.ERP.Core.Repositories;
using AutoMapper;

namespace XSTDZ.ERP.Application.Implements
{
    public class ProductProcedureServiceImpl : ApplicationServiceBase, IProductProcedureService
    {
        IRepository<ProductProcedure> _productProcedure;

        public ProductProcedureServiceImpl(IRepositoryContext repositoryContext, IRepository<ProductProcedure> productProcedure)
            : base(repositoryContext)
        {
            this._productProcedure = productProcedure;
        }


        public IList<ProductProcedureDto> GetAllProductProcedure()
        {
            var productProcedure = this._productProcedure.GetAll();

            return Mapper.Map<IList<ProductProcedure>, IList<ProductProcedureDto>>(productProcedure.ToList());
        }

        public IList<ProductProcedureDto> GetAllProductProcedure(Guid productID)
        {

            var productProcedure = this._productProcedure.GetAll(w => w.ProductID == productID);

            return Mapper.Map<IList<ProductProcedure>, IList<ProductProcedureDto>>(productProcedure.ToList());
        }
    }
}
